<?php
$root = ($this->getParam('root') !== 'disabled');
?>
<div class="zone medium signup"
    data-service="account.get"
    data-name="account"
    data-scope="console"
    data-event="load"
    data-success="redirect"
    data-success-param-redirect-url="/console"
    data-success-param-trigger-events="account.get">
    <h1 class="zone xl margin-bottom-large margin-top">
        Sign Up
    </h1>

    <div class="text-danger margin-bottom-large" data-ls-if="{{router.params.failure}} == 1">Registration Failed. Please try again later</div>

    <small class="pull-end text-size-small">* All fields are required</small>

    <form name="account.create"
        data-analytics
        data-newsletter
        data-analytics-activity
        data-analytics-event="submit"
        data-analytics-category="home"
        data-analytics-label="Create Account"
        data-service="account.create"
        data-scope="console"
        data-event="submit"
        data-success="trigger,hide"
        data-success-param-trigger-events="account.create"
        data-success-param-redirect-url="/console"
        data-failure="alert"
        data-failure-param-alert-text="Registration Failed. Please try again later"
        data-failure-param-alert-classname="error">

        <?php if($root): ?>
            <p>Please create your root account</p>
        <?php endif; ?>
        <input name="userId" type="hidden" value="unique()">

        <label>Name</label>
        <input name="name" type="text" autocomplete="name" placeholder="" required maxlength="128">

        <label>Email</label>
        <input name="email" type="email" autocomplete="email" placeholder="" required data-ls-bind="{{router.params.email}}">

        <label>Password</label>
        <input name="password" type="password" autocomplete="off" placeholder="" required data-forms-password-meter pattern=".{8,}" title="Eight or more characters">

        <div class="agree margin-top-large margin-bottom-large">
            <div class="pull-start margin-end-small margin-bottom">
                <input type="checkbox" required />
            </div>
            By signing up, you agree to the <a data-ls-attrs="href={{env.HOME}}/policy/terms" tabindex="-1" target="_blank" rel="noopener">Terms and Conditions</a> and <a data-ls-attrs="href={{env.HOME}}/policy/privacy" target="_blank" tabindex="-1" rel="noopener">Privacy Policy</a>
        </div>

        <div class="newsletter margin-top margin-bottom-large">
            <div class="pull-start margin-end-small margin-bottom">
                <input id="newsletter" type="checkbox" />
            </div>
            Sign up for our <a data-ls-attrs="href={{env.HOME}}/updates" tabindex="-1" target="_blank" rel="noopener">monthly newsletter</a> <span class="text-fade">(optional)</span>.
        </div>

        <button type="submit">Sign Up</button>
    </form>

</div>

<?php if(!$root): ?>
<div class="zone medium text-align-center">
    <a href="/auth/signin">Already have an account?</a>
</div>
<?PHP endif; ?>
